package me.leiusual.sharing.ui.order

import androidx.lifecycle.ViewModel
import dagger.Binds
import dagger.Module
import dagger.android.ContributesAndroidInjector
import dagger.multibindings.IntoMap
import me.leiusual.sharing.di.FragmentScope
import me.leiusual.sharing.di.ViewModelKey

/**
 * author: leiusual
 * create on: 2019-07-31
 * description:
 */
@Module
abstract class OrderModule {

  @FragmentScope
  @ContributesAndroidInjector
  abstract fun orderDetailFragment(): OrderDetailFragment

  @Binds
  @IntoMap
  @ViewModelKey(OrderDetailViewModel::class)
  abstract fun orderDetailViewModel(orderDetailViewModel: OrderDetailViewModel): ViewModel

  @FragmentScope
  @ContributesAndroidInjector
  abstract fun orderHomeFragment(): OrderHomeFragment

  @Binds
  @IntoMap
  @ViewModelKey(OrderHomeViewModel::class)
  abstract fun orderHomeViewModel(orderHomeViewModel: OrderHomeViewModel): ViewModel

  @FragmentScope
  @ContributesAndroidInjector
  abstract fun orderListFragment(): OrderListFragment

  @Binds
  @IntoMap
  @ViewModelKey(OrderListViewModel::class)
  abstract fun orderListViewModel(orderListViewModel: OrderListViewModel): ViewModel

  @FragmentScope
  @ContributesAndroidInjector
  abstract fun orderLogisticsFragment(): OrderLogisticsFragment

  @Binds
  @IntoMap
  @ViewModelKey(OrderLogisticsViewModel::class)
  abstract fun orderLogisticsViewModel(orderLogisticsViewModel: OrderLogisticsViewModel): ViewModel
}